package start.fly.test.database;


import java.sql.Connection;    
import java.sql.DriverManager;    
import java.sql.PreparedStatement;  
import java.sql.ResultSet;  
import java.sql.SQLException;    
   
public class DBConn {    
   public static final String url = "jdbc:mysql://www.ccjjltx.cn:3307/numbersystem?useUnicode=true&characterEncoding=utf8";    
   public static final String name = "com.mysql.jdbc.Driver";    
   public static final String user = "root";    
   public static final String password = "usbw";    
   
   public Connection conn = null;       
   public ResultSet res=null;  
   public DBConn() {    
       try {    
           //指定连接类型     
           Class.forName(name);  
           //获取连接    
           conn = DriverManager.getConnection(url, user, password);  
           //准备执行语句  
       } catch (Exception e) {    
           e.printStackTrace();    
       }    
   }    
 public Connection getCon() {  
     return this.conn;  
 }  
   public void close() {    
       try {    
           this.conn.close();    
       } catch (SQLException e) {    
           e.printStackTrace();    
       }    
   }    
}